package cn.lili.controller.feign;

import cn.lili.modules.service.UrbanSubstationService;
import cn.lili.modules.urbansubstation.client.UrbanSubstationClient;
import cn.lili.modules.urbansubstation.entity.dos.UrbanSubstation;
import cn.lili.modules.urbansubstation.entity.dto.UrbanSubstationDTO;
import cn.lili.modules.urbansubstation.entity.dto.UrbanSubstationSearchPageParams;
import cn.lili.modules.urbansubstation.entity.vos.UrbanSubstationVo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequiredArgsConstructor
public class UrbanSubstationFeignController implements UrbanSubstationClient {

    private final UrbanSubstationService urbanSubstationService;

    @Override
    public UrbanSubstation getUrbanSubstation(String userId) {
        return urbanSubstationService.getUrbanSubstation(userId);
    }

    @Override
    public UrbanSubstation addUrban(UrbanSubstationDTO urbanSubstationDTO) {
        return urbanSubstationService.add(urbanSubstationDTO);
    }

    @Override
    public Page<UrbanSubstationVo> page(UrbanSubstationSearchPageParams urbanSubstationSearchPageParams) {
        return urbanSubstationService.findByConditionPage(urbanSubstationSearchPageParams.getUrbanSubstationSearchParams(), urbanSubstationSearchPageParams.getPage());
    }

    @Override
    public UrbanSubstation getByAddressId(String areaId) {
        return urbanSubstationService.getByAddressId(areaId);
    }

    @Override
    public UrbanSubstation getById(String id) {
        return urbanSubstationService.getById(id);
    }

    @Override
    public List<UrbanSubstation> select() {
        return urbanSubstationService.select(null);
    }

    @Override
    public Page<UrbanSubstation> getByRegionIds(UrbanSubstationSearchPageParams searchPageParams) {
        return urbanSubstationService.getPageByRegionIds(searchPageParams);
    }


}
